/*
 * Copyright 2008 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.splink.library.logging {

	/**
	 * <code>LogLevel</code> is home to constants which are to be used with an <code>ILogger</code>
	 * instance. Every <code>ILogger</code> implementation provides a <code>log</code> method which
	 * expects a level parameter of the type uint. <code>LogLevel</code> provides the appropriate 
	 * constants.
	 * Its also possible to provide an <code>ILoggerFactory</code> with a <code>LogRange</code> which
	 * needs to be fed with <code>LogLevel</code> constants.
	 * 
	 * @author Max Kugland
	 */
	public class LogLevel {
		/**
		 * Log level for messages of the severity of trace events
		 */
		public static const TRACE : uint = 1;
		/**
		 * Log level for messages of the severity of info events
		 */
		public static const INFO : uint = 2;
		/**
		 * Log level for messages of the severity of debug events
		 */
		public static const DEBUG : uint = 3;
		/**
		 * Log level for messages of the severity of warning events
		 */
		public static const WARN : uint = 4;
		/**
		 * Log level for messages of the severity of error events
		 */
		public static const ERROR : uint = 5;
		/**
		 * Log level for messages of the severity of fatal events
		 */
		public static const FATAL : uint = 6;

		/**
		 * Internally used log level to mark garbage collection log events
		 */		internal static const GARBAGE : uint = 7;
		/**
		 * @return the String representaion of a log level.
		 */
		public static function getLevelOutputName(level : uint) : String {
			switch(level) {
				case 1:
					return "TRACE";
				case 2:
					return "INFO";
				case 3:
					return "DEBUG";
				case 4:
					return "WARN";
				case 5:
					return "ERROR";
				case 6:
					return "FATAL";
				case 7:
					return "GARBAGE";
				default:
					return "DEFAULT";
			}
		}
	}
}
